<template>
	<view class="">
		<cu-custom bgColor="bg-gradual-pink" :isBack="true" toURL='/pages/menu/menu'>
			<block slot="backText">返回</block>
			<block slot="content">设备履历</block>
		</cu-custom>
		<scroll-view scroll-x class="bg-white nav">
			<view class="flex text-center">
				<view class="cu-item flex-sub" :class="index==TabCur?'text-orange cur':''"
					v-for="(item,index) in TabList" :key="index" @tap="tabSelect" :data-id="index">
					{{item}}
				</view>
			</view>
		</scroll-view>
		<view class="" v-if="searchValue.materialCode">
			<RepairHistory ref="CheckoutBoxRef" v-if="TabCur === 0" :repairSearch='repairSearch' />
			<MainHistory ref="ConfirmBoxRef" v-if="TabCur === 1" :mainSearch='mainSearch' />
		</view>

	</view>
</template>

<script>
	import RepairHistory from './repairHistory.vue'
	import MainHistory from './mainHistory.vue'
	import {
		deepClone
	} from "@/common/base";

	export default {
		components: {
			RepairHistory,
			MainHistory
		},
		data() {
			return {
				TabCur: 0,
				TabList: ['维修履历', '保养履历'],
				searchValue: {},
				repairSearch: {},
				mainSearch: {}
			}
		},
		onLoad(obj) {
			this.searchValue = obj
			this.repairSearch = deepClone(this.searchValue)
		},

		methods: {
			tabSelect(e) {
				this.repairSearch = deepClone(this.searchValue)
				this.mainSearch = deepClone(this.searchValue)
				this.TabCur = e.currentTarget.dataset.id;
				this.scrollLeft = (e.currentTarget.dataset.id - 1) * 60
			}
		}
	}
</script>

<style>
</style>